from base_page import BasePage
from selenium.webdriver.common.by import By

class BaiduNewsPage(BasePage):
    url = "https://news.baidu.com/"
    __inputNews = (By.CSS_SELECTOR, "#ww")
    __searchBtn = (By.CSS_SELECTOR, "#s_btn_wr")


    def open_page(self):
        self.driver.get(self.url)

    def input_news(self, news):
        self.find_element(*self.__inputNews).send_keys(news)

    def click_searchBtn(self):
        self.find_element(*self.__searchBtn).click()

    def search_news(self, news):
        self.open_page()
        self.input_news(news)
        self.click_searchBtn()